# This file is licensed under the Elastic License 2.0. Copyright 2021 StarRocks Limited.

set(EXEC_FILES
        ./test_main.cpp
        ./column/array_column_test.cpp
        ./column/avx_numeric_column_test.cpp
        ./column/binary_column_test.cpp
        ./column/chunk_test.cpp
        ./column/column_helper_test.cpp
        ./column/column_pool_test.cpp
        ./column/const_column_test.cpp
        ./column/date_value_test.cpp
        ./column/field_test.cpp
        ./column/fixed_length_column_test.cpp
        ./column/decimalv3_column_test.cpp
        ./column/nullable_column_test.cpp
        ./column/object_column_test.cpp
        ./column/timestamp_value_test.cpp
        ./column/vectorized_schema_test.cpp
        ./common/config_test.cpp
        ./common/resource_tls_test.cpp
        ./common/status_test.cpp
        ./env/compressed_file_test.cpp
        ./env/env_broker_test.cpp
        ./env/env_posix_test.cpp
        ./env/env_memory_test.cpp
        ./env/output_stream_wrapper_test.cpp
        #./exec/broker_reader_test.cpp
        ./exec/broker_scanner_test.cpp
        ./exec/file_scan_node_test.cpp
        ./exec/buffered_reader_test.cpp
        ./exec/convert_scan_node_test.cpp
        ./exec/es_http_scan_node_test.cpp
        ./exec/es_predicate_test.cpp
        ./exec/es_query_builder_test.cpp
        #./exec/es_scan_reader_test.cpp
        #./exec/json_scanner_test.cpp
        #./exec/orc_scanner_test.cpp
        #./exec/parquet_scanner_test.cpp
        ./exec/plain_text_line_reader_bzip_test.cpp
        ./exec/plain_text_line_reader_gzip_test.cpp
        ./exec/plain_text_line_reader_lz4frame_test.cpp
        ./exec/plain_text_line_reader_uncompressed_test.cpp
        #./exec/tablet_info_test.cpp
        ./exec/tablet_sink_test.cpp
        ./exec/vectorized/agg_hash_map_test.cpp
        ./exec/vectorized/csv_scanner_test.cpp
        ./exec/vectorized/chunks_sorter_test.cpp
        ./exec/vectorized/join_hash_map_test.cpp
        ./exec/vectorized/json_scanner_test.cpp
        ./exec/vectorized/hdfs_scanner_test.cpp
        ./exec/vectorized/orc_scanner_adapter_test.cpp
        ./exec/parquet/parquet_schema_test.cpp
        ./exec/parquet/encoding_test.cpp
        ./exec/parquet/page_reader_test.cpp
        ./exec/parquet/metadata_test.cpp
        ./exec/parquet/group_reader_test.cpp
        ./exec/parquet/file_reader_test.cpp
        ./exprs/agg/aggregate_test.cpp
        ./exprs/bitmap_function_test.cpp
        ./exprs/hll_function_test.cpp
        ./exprs/hybird_set_test.cpp
        ./exprs/json_function_test.cpp
        ./exprs/math_functions_test.cpp
        ./exprs/percentile_approx_test.cpp
        ./exprs/string_functions_test.cpp
        ./exprs/timestamp_functions_test.cpp
        ./exprs/vectorized/arithmetic_expr_test.cpp
        ./exprs/vectorized/arithmetic_operation_test.cpp
        ./exprs/vectorized/array_element_expr_test.cpp
        ./exprs/vectorized/decimal_binary_function_test.cpp
        ./exprs/vectorized/array_expr_test.cpp
        ./exprs/vectorized/array_functions_test.cpp
        ./exprs/vectorized/binary_predicate_test.cpp
        ./exprs/vectorized/bitmap_functions_test.cpp
        ./exprs/vectorized/case_expr_test.cpp
        ./exprs/vectorized/cast_expr_test.cpp
        ./exprs/vectorized/decimal_cast_expr_decimal_test.cpp
        ./exprs/vectorized/decimal_cast_expr_integer_test.cpp
        ./exprs/vectorized/decimal_cast_expr_float_test.cpp
        ./exprs/vectorized/decimal_cast_expr_time_test.cpp
        ./exprs/vectorized/decimal_cast_expr_decimalv2_test.cpp
        ./exprs/vectorized/coalesce_expr_test.cpp
        ./exprs/vectorized/compound_predicate_test.cpp
        ./exprs/vectorized/condition_expr_test.cpp
        ./exprs/vectorized/encryption_functions_test.cpp
        ./exprs/vectorized/function_call_expr_test.cpp
        ./exprs/vectorized/geography_functions_test.cpp
        ./exprs/vectorized/hash_functions_test.cpp
        ./exprs/vectorized/hyperloglog_functions_test.cpp
        ./exprs/vectorized/if_expr_test.cpp
        ./exprs/vectorized/in_iterator_predicate_test.cpp
        ./exprs/vectorized/in_predicate_test.cpp
        ./exprs/vectorized/is_null_predicate_test.cpp
        ./exprs/vectorized/json_functions_test.cpp
        ./exprs/vectorized/like_test.cpp
        ./exprs/vectorized/math_functions_test.cpp
        ./exprs/vectorized/null_if_expr_test.cpp
        ./exprs/vectorized/percentile_functions_test.cpp
        ./exprs/vectorized/string_fn_concat_test.cpp
        ./exprs/vectorized/string_fn_locate_test.cpp
        ./exprs/vectorized/string_fn_pad_test.cpp
        ./exprs/vectorized/string_fn_repeat_test.cpp
        ./exprs/vectorized/string_fn_reverse_test.cpp
        ./exprs/vectorized/string_fn_space_test.cpp
        ./exprs/vectorized/string_fn_substr_test.cpp
        ./exprs/vectorized/string_fn_test.cpp
        ./exprs/vectorized/string_fn_trim_test.cpp
        ./exprs/vectorized/string_fn_money_format_decimal_test.cpp
        ./exprs/vectorized/time_functions_test.cpp
        ./exprs/vectorized/es_functions_test.cpp
        ./exprs/vectorized/utility_functions_test.cpp
        ./exprs/vectorized/runtime_filter_test.cpp
        ./formats/csv/array_converter_test.cpp
        ./formats/csv/binary_converter_test.cpp
        ./formats/csv/boolean_converter_test.cpp
        ./formats/csv/date_converter_test.cpp
        ./formats/csv/datetime_converter_test.cpp
        ./formats/csv/decimalv2_converter_test.cpp
        ./formats/csv/float_converter_test.cpp
        ./formats/csv/nullable_converter_test.cpp
        ./formats/csv/numeric_converter_test.cpp
        ./geo/geo_functions_test.cpp
        ./geo/geo_types_test.cpp
        ./geo/wkt_parse_test.cpp
        #./http/http_client_test.cpp
        ./http/http_utils_test.cpp
        ./http/message_body_sink_test.cpp
        #./http/metrics_action_test.cpp
        ./http/stream_load_test.cpp
        ./storage/aggregate_func_test.cpp
        ./storage/comparison_predicate_test.cpp
        ./storage/decimal12_test.cpp
        ./storage/utils_test.cpp
        #./storage/delete_handler_test.cpp
        #./storage/delta_writer_test.cpp
        ./storage/del_vector_test.cpp
        ./storage/file_utils_test.cpp
        ./storage/fs/file_block_manager_test.cpp
        ./storage/generic_iterators_test.cpp
        ./storage/hll_test.cpp
        ./storage/in_list_predicate_test.cpp
        ./storage/key_coder_test.cpp
        ./storage/lru_cache_test.cpp
        ./storage/memory/column_delta_test.cpp
        ./storage/memory/column_test.cpp
        ./storage/memory/hash_index_test.cpp
        ./storage/memory/mem_tablet_test.cpp
        ./storage/memory/partial_row_batch_test.cpp
        ./storage/memory/schema_test.cpp
        ./storage/null_predicate_test.cpp
        ./storage/olap_meta_test.cpp
        ./storage/protobuf_file_test.cpp
        #./storage/options_test.cpp
        ./storage/page_cache_test.cpp
        ./storage/primary_index_test.cpp
        ./storage/primary_key_encoder_test.cpp
        ./storage/row_block_test.cpp
        ./storage/row_block_v2_test.cpp
        ./storage/row_cursor_test.cpp
        ./storage/rowset/beta_rowset_test.cpp
        ./storage/rowset/segment_v2/binary_dict_page_test.cpp
        ./storage/rowset/segment_v2/binary_plain_page_test.cpp
        ./storage/rowset/segment_v2/binary_prefix_page_test.cpp
        ./storage/rowset/segment_v2/bitmap_index_test.cpp
        ./storage/rowset/segment_v2/bitshuffle_page_test.cpp
        ./storage/rowset/segment_v2/block_bloom_filter_test.cpp
        ./storage/rowset/segment_v2/bloom_filter_index_reader_writer_test.cpp
        ./storage/rowset/segment_v2/column_reader_writer_test.cpp
        ./storage/rowset/segment_v2/encoding_info_test.cpp
        ./storage/rowset/segment_v2/frame_of_reference_page_test.cpp
        ./storage/rowset/segment_v2/ordinal_page_index_test.cpp
        ./storage/rowset/segment_v2/plain_page_test.cpp
        ./storage/rowset/segment_v2/rle_page_test.cpp
        ./storage/rowset/segment_v2/row_ranges_test.cpp
        ./storage/rowset/segment_v2/segment_test.cpp
        ./storage/rowset/segment_v2/zone_map_index_test.cpp
        ./storage/rowset/unique_rowset_id_generator_test.cpp
        #./storage/schema_change_test.cpp
        ./storage/selection_vector_test.cpp
        ./storage/snapshot_meta_test.cpp
        ./storage/short_key_index_test.cpp
        ./storage/skiplist_test.cpp
        ./storage/storage_types_test.cpp
        ./storage/tablet_meta_test.cpp
        ./storage/tablet_meta_manager_test.cpp
        ./storage/tablet_updates_test.cpp
        ./storage/update_manager_test.cpp
        ./storage/vectorized/aggregate_iterator_test.cpp
        ./storage/vectorized/chunk_aggregator_test.cpp
        ./storage/vectorized/chunk_helper_test.cpp
        ./storage/vectorized/column_aggregator_test.cpp
        ./storage/vectorized/column_predicate_test.cpp
        ./storage/vectorized/conjunctive_predicates_test.cpp
        ./storage/vectorized/convert_helper_test.cpp
        ./storage/vectorized/merge_iterator_test.cpp
        ./storage/vectorized/memtable_test.cpp
        ./storage/vectorized/projection_iterator_test.cpp
        ./storage/vectorized/push_handler_test.cpp
        ./storage/vectorized/range_test.cpp
        ./storage/vectorized/union_iterator_test.cpp
        ./storage/vectorized/unique_iterator_test.cpp
        ./storage/vectorized/cumulative_compaction_test.cpp
        ./storage/vectorized/base_compaction_test.cpp
        ./storage/vectorized/rowset_merger_test.cpp
        #./plugin/plugin_loader_test.cpp
        ./plugin/plugin_mgr_test.cpp
        #./plugin/plugin_zip_test.cpp
        ./runtime/buffer_control_block_test.cpp
        #./runtime/buffered_block_mgr2_test.cpp
        #./runtime/buffered_tuple_stream2_test.cpp
        ./runtime/datetime_value_test.cpp
        ./runtime/decimalv2_value_test.cpp
        ./runtime/decimalv3_test.cpp
        ./runtime/decimal_value_test.cpp
        #./runtime/disk_io_mgr_test.cpp
        ./runtime/external_scan_context_mgr_test.cpp
        ./runtime/fragment_mgr_test.cpp
        ./runtime/free_list_test.cpp
        ./runtime/int128_arithmetic_ops_test.cpp
        ./runtime/kafka_consumer_pipe_test.cpp
        ./runtime/large_int_value_test.cpp
        ./runtime/load_channel_mgr_test.cpp
        #./runtime/mem_limit_test.cpp
        ./runtime/memory/chunk_allocator_test.cpp
        #./runtime/memory_scratch_sink_test.cpp
        ./runtime/memory/system_allocator_test.cpp
        ./runtime/mem_pool_test.cpp
        ./runtime/raw_value_test.cpp
        ./runtime/result_queue_mgr_test.cpp
        #./runtime/routine_load_task_executor_test.cpp
        #./runtime/small_file_mgr_test.cpp
        ./runtime/snapshot_loader_test.cpp
        ./runtime/stream_load_pipe_test.cpp
        ./runtime/string_buffer_test.cpp
        ./runtime/string_value_test.cpp
        ./runtime/type_descriptor_test.cpp
        ./runtime/thread_resource_mgr_test.cpp
        ./runtime/type_descriptor_test.cpp
        #./runtime/tmp_file_mgr_test.cpp
        #./runtime/user_function_cache_test.cpp
        ./runtime/vectorized/sorted_chunks_merger_test.cpp
        ./simd/simd_test.cpp
        ./util/aes_util_test.cpp
        ./util/arrow/arrow_row_batch_test.cpp
        ./util/arrow/arrow_row_block_test.cpp
        #./util/arrow/arrow_work_flow_test.cpp
        ./util/bitmap_test.cpp
        ./util/bitmap_value_test.cpp
        ./util/bit_stream_utils_test.cpp
        ./util/bit_util_test.cpp
        ./util/block_compression_test.cpp
        ./util/blocking_queue_test.cpp
        ./util/brpc_stub_cache_test.cpp
        ./util/cidr_test.cpp
        ./util/coding_test.cpp
        ./util/core_local_test.cpp
        ./util/countdown_latch_test.cpp
        ./util/crc32c_test.cpp
        ./util/dynamic_cache_test.cpp
        #./util/starrocks_metrics_test.cpp
        ./util/faststring_test.cpp
        ./util/file_cache_test.cpp
        ./util/filesystem_util_test.cpp
        ./util/frame_of_reference_coding_test.cpp
        ./util/internal_queue_test.cpp
        ./util/json_util_test.cpp
        ./util/lru_cache_util_test.cpp
        ./util/md5_test.cpp
        ./util/monotime_test.cpp
        ./util/mysql_row_buffer_test.cpp
        ./util/new_metrics_test.cpp
        ./util/parse_util_test.cpp
        ./util/path_trie_test.cpp
        ./util/path_util_test.cpp
        ./util/radix_sort_test.cpp
        ./util/rle_encoding_test.cpp
        ./util/scoped_cleanup_test.cpp
        ./util/string_parser_test.cpp
        ./util/string_util_test.cpp
        #./util/system_metrics_test.cpp
        ./util/tdigest_test.cpp
        ./util/thread_test.cpp
        ./util/trace_test.cpp
        ./util/types_test.cpp
        ./util/uid_util_test.cpp
        ./util/utf8_check_test.cpp
        ./util/buffered_stream_test.cpp
        ./util/int96_test.cpp
        ./util/bit_packing_test.cpp
        #./util/zip_util_test.cpp
        )

if (WITH_HDFS)
    set(EXEC_FILES ${EXEC_FILES} ./exec/vectorized/hdfs_scan_node_test.cpp)
endif ()

add_executable(starrocks_test ${EXEC_FILES})

TARGET_LINK_LIBRARIES(starrocks_test ${TEST_LINK_LIBS})
SET_TARGET_PROPERTIES(starrocks_test PROPERTIES COMPILE_FLAGS "-fno-access-control")
SET_TARGET_PROPERTIES(${PLUGIN_FILE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/test")

# bytes_test requires tcmalloc which conflicts with sanitizer.
# Thus we need a standalone binary without sanitizer to test it.
add_executable(bytes_test
        ./column/bytes_test.cpp
        )

set_target_properties(bytes_test PROPERTIES
        COMPILE_OPTIONS
        "-lpthread;-std=gnu++17;-g;-fno-sanitize=address")

set_target_properties(bytes_test PROPERTIES
        LINK_OPTIONS
        "-static-libstdc++;-static-libgcc;-fno-sanitize=address")

TARGET_LINK_LIBRARIES(bytes_test
        pthread
        gtest
        tcmalloc
        )
